package com.bluesky.plum.domain.repository.impl;

import java.util.List;

import com.bluesky.plum.domain.repository.Repository;
import com.bluesky.plum.domain.repository.search.condition.Condition;

public class HibernateRepository implements Repository<Object> {

	private Class entityClass;
	private HibernateRepositorySupport repositorySupport;

	public HibernateRepository(HibernateRepositorySupport repositorySupport,
			Class entityClass) {
		this.repositorySupport = repositorySupport;
		this.entityClass = entityClass;
	}

	@Override
	public void add(Object entity) {
		repositorySupport.add(entity);

	}

	@Override
	public boolean equals(Object obj1, Object obj2) {

		return repositorySupport.equals(obj1, obj2);
	}

	@Override
	public List<Object> find(Condition condition) {

		return repositorySupport.find(entityClass, condition);
	}

	@Override
	public List<Object> getAll() {

		return repositorySupport.getAll(entityClass);
	}

	@Override
	public Object getByIndex(int index) {

		return repositorySupport.getByIndex(entityClass, index);
	}

	@Override
	public List<Object> getByPage(int pageLength, int pageNumber) {

		return repositorySupport.getByPage(entityClass, pageLength, pageNumber);
	}

	@Override
	public int getCount() {

		return repositorySupport.getCount(entityClass);
	}

	@Override
	public void remove(Object entity) {
	}

	@Override
	public void update(Object oldEntity, Object newEntity) {
		repositorySupport.update(oldEntity, newEntity);

	}

}
